package cn.dnui_xcz826.dnuifood_16110100826.model;

import cn.dnui_xcz826.dnuifood_16110100826.controller.Constants;
import cn.dnui_xcz826.dnuifood_16110100826.iface.CollectIface;
import cn.dnui_xcz826.dnuifood_16110100826.listener.onRetrofitListener;
import cn.dnui_xcz826.dnuifood_16110100826.service.CollectService;
import retrofit2.Call;

/**
 * Created by Administrator on 2018/11/5.
 */

public class CollectModel extends BaseModel implements CollectIface {
    private CollectService service;
    public CollectModel(){
        //super();
        service=retrofit.create(CollectService.class);
    }

    @Override
    public void getAllUserCollection(String user_id, String flag, onRetrofitListener listener) {
        Call call=service.doGetAllUserCollection(user_id,flag);
        bindCallback(call,listener, Constants.GETALLUSERCOLLECTION);
    }

    @Override
    public void userCollectShop(String user_id, String shop_id, onRetrofitListener listener) {
        Call call=service.doUserCollectShop(user_id,shop_id);
        bindCallback(call,listener,Constants.USERCOLLECTSHOP);
    }

    @Override
    public void userCollectFood(String user_id, String food_id, onRetrofitListener listener) {
        Call call=service.doUserCollectFood(user_id,food_id);
        bindCallback(call,listener,Constants.USERCOLLECTFOOD);
    }

    @Override
    public void isCollected(String user_id, String shop_food_id, String flag, onRetrofitListener listener) {
        Call call=service.doIsCollected(user_id,shop_food_id,flag);
        bindCallback(call,listener,Constants.ISCOLLECTED);
    }
}
